import request from '@/utils/request'

export function findList(data) {
    return request({
        url: '/site/',
        method: 'get',
        params: data,
    })
}

export function findDetail(id) {
    return request({
        url: '/site/'+id,
        method: 'get',
    })
}
export function save(data) {
    if(data.id ==null){
        return request({
            url: '/site',
            method: 'post',
            data: data,
        })
    }else{
        return request({
            url: '/site/'+data.id,
            method: 'put',
            data: data,
        })
    }
}
export function findCityList() {
    return request({
        url: '/site/findCityList',
        method: 'get',
    })
}
export function findCityListByParentId(parentId) {
    return request({
        url: '/site/findCityListByParentId/'+parentId,
        method: 'get',
    })
}
export function changeStatus(id,status) {
    return request({
        url: '/site/changeStatus/'+id,
        method: 'put',
        params:{'status':status}
    })
}
export function changeDefault(id) {
    return request({
        url: '/site/changeDefault/'+id,
        method: 'put',
    })
}
export function deleted(id) {
    return request({
        url: '/site/'+id,
        method: 'delete',
    })
}


export function findRegionList(data) {
    return request({
        url: '/site/region/',
        method: 'get',
        params: data,
    })
}
export function findRegionDetail(id) {
    return request({
        url: '/site/region/'+id,
        method: 'get',
    })
}
export function saveRegion(data) {
    if(data.id ==null){
        return request({
            url: '/site/region/',
            method: 'post',
            data: data,
        })
    }else{
        return request({
            url: '/site/region/'+data.id,
            method: 'put',
            data: data,
        })
    }
}
export function deletedRegion(id) {
    return request({
        url: '/site/region/'+id,
        method: 'delete',
    })
}
export function changeStatusRegion(id,status) {
    return request({
        url: '/site/region/changeStatus/'+id,
        method: 'put',
        params:{'status':status}
    })
}